package com.ganee.agora.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.ganee.agora.R
import com.ganee.agora.manager.RecyclerViewHolder
import com.ganee.agora.model.SearchListEntity


/**
 *    @author : EricCui
 *    date   : 2020-01-01 17:52
 *    desc   : 搜索列表adapter
 */

class SearchListAdapter(entityList: MutableList<SearchListEntity>) : BaseQuickAdapter<SearchListEntity,
        RecyclerViewHolder>(R.layout.item_recyclerview_search, entityList) {


    override fun convert(helper: RecyclerViewHolder, item: SearchListEntity?) {
        if (item != null) {
            val icon = helper.getView<ImageView>(R.id.item_search_iv_icon) as ImageView
            icon.setImageResource(item.resId)
            helper.setText(R.id.item_search_tv_title, item.title)
        }
    }
}

